# include <bits/stdc++.h>
# define N 500005
using namespace std;
int n,m,q;
pair<int,int> p[N];
int xl[N],xr[N],yl[N],yr[N];
bool died[N];
struct Segment_Tree
{
    vector<int> A[N<<2],B[N<<2];
    void add(int now,int l,int r,int L,int R,int id)
    {
        if(l>R || r<L)
            return ;
        A[now].push_back(id);
        if(L<=l && r<=R)
        {
            B[now].push_back(id);
            return ;
        }
        int mid=l+r>>1;
        add(now<<1,l,mid,L,R,id);
        add(now<<1|1,mid+1,r,L,R,id);
    }
    int check(vector<int> &v,int y)
    {
        while(v.size() && died[v.back()])
            v.pop_back();
        if(v.size() && yr[v.back()]>=y)
            return v.back();
        return 0;
    }
    int get(int now,int l,int r,int L,int R,int y)
    {
        if(l>R || r<L)
            return 0;
        int tmp=check(B[now],y);
        if(tmp)
            return tmp;
        if(L<=l && r<=R)
            return check(A[now],y);
        int mid=l+r>>1;
        tmp=get(now<<1,l,mid,L,R,y);
        if(tmp)
            return tmp;
        return get(now<<1|1,mid+1,r,L,R,y);
    }
}T;
int main()
{
    freopen("grid.in","r",stdin);
    freopen("grid.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>q;
    for(int i=1;i<=q;i++)
        cin>>p[i].first>>p[i].second;
    sort(p+1,p+q+1,[](pair<int,int> a,pair<int,int> b)
    {
        return a.second<b.second;
    });
    for(int i=1;i<=q;i++)
    {
        xl[i]=xr[i]=p[i].first;
        yl[i]=yr[i]=p[i].second;
        while(1)
        {
            int id=max({T.get(1,1,n,xl[i],xr[i],yl[i]-2),T.get(1,1,n,xl[i]-1,xr[i]+1,yl[i]-1),T.get(1,1,n,xl[i]-2,xr[i]+2,yl[i])});
            if(!id)
            {
                T.add(1,1,n,xl[i],xr[i],i);
                break;
            }
            died[id]=1;
            xl[i]=min(xl[i],xl[id]);
            xr[i]=max(xr[i],xr[id]);
            yl[i]=min(yl[i],yl[id]);
            yr[i]=max(yr[i],yr[id]);
        }
    }
    long long ans=0;
    for(int i=1;i<=q;i++)
        if(!died[i])
            ans+=1ll*(xr[i]-xl[i]+1)*(yr[i]-yl[i]+1);
    cout<<ans<<endl;
    return 0;
}